package org.example.mapper;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.bean.User;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface UserDao {
    public List<User>list();
    @Delete("DELETE FROM `user`WHERE id =#{id}")
    public Void del(int id);
    @Insert("INSERT INTO `user`(uname,name,rname,sname,tel,type,text,state) VALUES(#{uname},#{name},#{rname},#{sname},#{tel},#{type},#{text},#{state})")
    public void add(User user);
    @Update("UPDATE user SET `name`=#{name},rname=#{rname},sname=#{sname},uname=#{uname},tel=#{tel},state=#{state},type=#{type},text=#{text} WHERE id=#{id}")
    public void update(User user);
    @Select("SELECT * FROM user WHERE uname = #{uname}")
    public User getUserByUsername(String uname);
}
